﻿using HamcoWcs.Contract.ContractCommon;
using HamcoWcs.Contract.ContractMainTask.IMainTaskParsers;
using HamcoWcs.Entitys.MainTasks;
using HamcoWcs.Models.Common.Enums;
using HamcoWcs.Models.EdgeInfos;
using HamcoWcs.Service.Common;

namespace HamcoWcs.Service.MainTasks.SubTaskParsers
{
    [AutoInject(typeof(ISubTaskParser), InjectType.Scope)]
    public class SubTaskParser_SrmStraightOutTask : SubTaskParserBase
    {
        public override EnumSubTaskType SubTaskType => EnumSubTaskType.SrmStraightOutTask;
        public SubTaskParser_SrmStraightOutTask(ILocationService locationService) : base(locationService) { }


        public override void Deal(MainTask mainTask, EdgeInfoDto edge)
        {
            var subTask = CreateNewSubTask(mainTask, edge);
            mainTask.SubTasks.Add(subTask);


            //mainTask.SubTasks.Add(new SubTask()
            //{
            //    TaskFrom = mainTask.Sender,
            //    SubTaskId = "",
            //    SubTaskType = SubTaskType.ToString(),
            //    UnitId = mainTask.UnitId,
            //    FromLoc = edge.FromNode, //todo
            //    ToLoc = edge.ToNode, //todo
            //    TaskSeq = mainTask.SubTasks.Count + 1,
            //    TaskStatus = EnumSubTaskStatus.NewTask.ToString(),
            //    PlcName = edge.ExcutePlc  // CJSTW100 | CJSTW200
            //});
        }
    }
}
